module.exports = (Vue)=>{
    //全局过滤器
    Vue.filter('commonNum',(value,arg=2)=>{
        return value.toFixed(arg)
    })

    const role = 'admin'
//    2.注册全局指令
    Vue.directive('role',{
        //简写使用的bind
        bind(el,binding){
            console.log(el,binding)
            console.log('bind')
        },
        inserted(el,binding){
            console.log(el,binding)
            console.log('inserted')
            if(binding.value===role){
                el.remove()
            }
        },
        update(el,binding){
            console.log(el,binding)
            console.log('update')
        },
        componentUpdated(el,binding){
            console.log(el,binding)
            console.log('componentUpdated')
        },
        unbind(el,binding){
            console.log(el,binding)
            console.log('unbind')
        }
    })
}